package ComposicaoItemPedidoDepartamento;

import org.nakedobjects.extended.Cardinality;
import org.nakedobjects.extended.CompositeAssociation;
import org.nakedobjects.extended.Entity;
import org.nakedobjects.extended.Way;
import org.nakedobjects.extended.CompositeAssociation.CompositeType;
import org.nakedobjects.object.AbstractNakedObject;

@Entity
public class ItemPedido extends AbstractNakedObject{
	@CompositeAssociation(
			cardinality = Cardinality.ManyToOne, 
			compositeType = CompositeType.Physical, 
			fieldRelatedName = "itenspedidos", 
			relatedWith = Departamento.class, 
			way = Way.TwoWay 
			)
	private Departamento departamento ;
	
	public void setDepartamento(Departamento departamento) {
		this.departamento = departamento;
		objectChanged();
	}
	
	public Departamento getDepartamento() {
		resolve(departamento);
		return departamento;
	}
}
